<?php
	
	function usr(){
		return sn()->usr();
	}
	
	function Upload(){
		return getObj('Upload');
	}
	
	function Desktop(){
		return getObj('Desktop');	
	}
	
	function Screen(){
		return getObj('Screen');	
	}
	
	function Transput(){
		return getObj('Transput');	
	}
	
	function Smash(){
		return getObj('Smash');	
	}
	
	function DskPage(){
		return getObj('DskPage');
	}
	
	function DskJs(){
		return OB()->js();
	}
	
	function Smajax(){
		return getObj('Smajax');
	}
	
	function APP(){
		return Desktop()->APP();
	}
	
	function OB(){
		return smout()->get_handle();	
	}
	
	function httpE($e, $m=''){
		error_log($m);
		OB()->set_status($e);
		OB()->put_headers();
		Screen()->run_error($m);
	}
	
	function Desk(){
		return Fmgr()->open('desk:/');	
	}
	
	function appHref($P){
		return Desk()->appHref($P->path);
	}

	function guiArg($k){
		return APP()->arg($k);
	}

	function Toolbar(){
		return App()->Toolbar();
	}

	// GUI-specific css
	function css_include($filename, $path=false){
		OB()->css_include($filename, $path);	
	}
	
	function ln($str){
		OB()->ln($str);
	}
	
	function jsln($s){
		OB()->jsln($s);	
	}
	
	function cssln($s){
		OB()->cssln($s);	
	}

	// GUI-specific scripts
	function js_include(){
		foreach(func_get_args() as $f) DskJs()->include_before('script', APP()->file_uri($f, '/js'));
	}
	
	// scripts under jslib, e.g. prototype
	function js_include_shared(){
		foreach(func_get_args() as $f) DskJs()->include_before('script', SHR.'/smrnl/'.SMERNEL.'/js/'.$f);
	}
	
	


